@echo off
set port=8181
for /f "tokens=1-5" %%i in ('netstat -ano^|findstr ":%port%"') do (
    echo kill the process %%m who use the port 
    taskkill /pid %%m -t -f
    goto q
)
:q
cd target
copy /y cw.jar d:\jar
cd d:\jar
d:
setlocal enabledelayedexpansion
set jar-date=cw-%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%%time:~6,2%.jar
ren cw.jar %jar-date%
exit 0
